package com.bohua.child.controller;

import com.bohua.child.common.Lay;
import com.bohua.child.common.Msg;
import com.bohua.child.entity.Attendance;
import com.bohua.child.service.AttendanceService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
/**
 * 考勤表控制器
 * @author shichenyang
 * @email gyv12345@163.com
 * @date 2019/01/17
 */
@Controller
@RequestMapping("/attendance")
public class AttendanceController {
    @Resource
    private AttendanceService attendanceService;

    @RequestMapping
    public String attendance(){
        return "attendance/attendance.html";
    }
    @RequestMapping("/add")
    public String add(){
        return "attendance/addAttendance.html";
    }

    @RequestMapping("/update")
    public String update(){
        return "attendance/updateAttendance.html";
    }

    @RequestMapping("/getAttendances")
    @ResponseBody
    public Lay getAttendances(Attendance attendance,Integer page,Integer limit){
        return attendanceService.getAttendances(attendance,page,limit);
    }
    @RequestMapping("/addAttendance")
    @ResponseBody
    public Msg addAttendance(Attendance attendance){
        return attendanceService.addAttendance(attendance);
    }

    @RequestMapping("/updateAttendance")
    @ResponseBody
    public Msg updateAttendance(Attendance attendance){
        return attendanceService.updateAttendance(attendance);
    }

    @RequestMapping("/delAttendance")
    @ResponseBody
    public Msg delAttendance(Attendance attendance){
        return attendanceService.delAttendance(attendance);
    }
}
